<template>
	<coco-form-item :label="label" :labelColor="labelColor" :required="required">
		<tui-radio-group @change="valueChange">
			<slot :value="modelValue"></slot>
		</tui-radio-group>
	</coco-form-item>
</template>

<script>
	export default {
		model: {
			event: "change",
			prop: "value"
		},
		props: {
			value: {
				type: String,
				default: null,
			},
			label: {
				type: String,
				default: '字段标题'
			},
			labelColor: {
				type: String,
				default: '#888888'
			},
			required: {
				type: Boolean,
				default: false,
			}
		},
		data() {
			return {
				// 变量
			};
		},
		computed: {
			modelValue: {
				get() {
					return this.value;
				},
				set(val) {
					this.$emit('change', val);
				},
			}
		},
		methods: {
			valueChange(e) {
				this.modelValue = e.detail.value;
			}
		}
	}
</script>

<style lang="scss" scoped>
</style>
